<!--{include /service/service_head}-->

<!-- End #sidebar -->
	<div id="main-content">
		<!-- Main Content Section with everything -->

		<!-- Page Head -->
		
		<div class="content-box">
			<!-- Start Content Box -->
			<div class="content-box-header">
				<h3>スタッフ</h3>
				<ul class="content-box-tabs" style="display:none;">
					<li><a href="#tab1" class="default-tab">详细</a></li>
					<!-- href must be unique and match the id of target div -->
					<li><a href="#tab2">编辑</a></li>
				</ul>
				<div class="clear"></div>
			</div>
			<!-- End .content-box-header -->
			{$errorMsg}
          <form action="/service/staffManageEdit.php" id="indexform" method="post">
			<div class="content-box-content">

				<div class="tab-content default-tab" id="tab1">
					<!-- This is the target div. id must match the href of this div's tab -->
					<div class="table_box">
						<table>
						<tbody id="person_info">
							<tr>
								<td class="text_left">姓：<input type="hidden" name="staff_id" value="{$staff['id']}"></td>
								<td>
									<input type="text" name="family_name" value="{$staff['family_name']}" require="true" datatype="require|limit" min="2" />名：
									<input type="text" name="personal_name" value="{$staff['personal_name']}" require="true" datatype="require|limit" min="2" />
								</td>
							</tr>
							<tr>
								<td class="text_left">メールアドレス：</td>
								<td><input type="text" name="email" value="{$staff['email']}" require="true" datatype="require|limit" min="2" /></td>
							</tr>
							<tr>
								<td class="text_left">性別：</td>
								<td>
									<select name="sex">
										<option value="0">選択してください</option>
										${Utility::Option(array(0 => "女", 1 => "男"), $staff['sex'])}
									</select>
								</td>
							</tr>
							<tr>
								<td class="text_left">職員写真：</td>
								<td><input type="text" name="img" value="{$staff['img']}" require="true" datatype="require|limit" min="2" /></td>
							</tr>
							<tr>
								<td class="text_left">電話番号：</td>
								<td><input type="text" name="tel_no" value="{$staff['tel_no']}" require="true" datatype="require|limit" min="2" /></td>
							</tr>
							<tr>
								<td class="text_left">住所：</td>
								<td><input type="text" name="addr" value="{$staff['addr']}" require="true" datatype="require|limit" min="2" /></td>
							</tr>
							<tr>
								<td class="text_left">所属店舗：</td>
								<td>
									<select name="shop_id">
										<option value="0">選択してください</option>
										${Utility::Option(Utility::OptionArray($shopList, 'id', 'shop_name'), $staff['shop_id'])}
									</select>
								</td>
							</tr>
							<tr>
								<td class="text_left">pr：</td>
								<td><input type="text" name="pr" value="{$staff['pr']}" require="true" datatype="require|limit" min="2" /></td>
							</tr>
							<!--{if ($skillList_view = StaffSkill::GetServicesById($staff['id'])) != null }-->
							<tr>
								<td class="text_left">スキル：</td>
								<td>
									<table>
										<tbody id="addDelete">
										<!--{loop $skillList_view $index1 $one1}-->
										<tr>
											<td>{$one1['service_name']}(level:{$one1['skill_level']})</td>
											<td><a class="close_btn" staffId="{$staff['id']}" serviceId="{$one1['id']}"></a></td>
										</tr>
										<!--{/loop}-->
										</tbody>
									</table>
								</td>
							</tr>
							<!--{/if}--> 
							<tr>
								<td class="text_left">スキルの追加：</td>
								<td>
									<p>
										<select name="service_id">
											<option value="0">選択してください</option>
											${Utility::Option(Utility::OptionArray($serviceList, 'id', 'service_name'), 0)}
										</select>
									</p>
									<p>技能レベル:
										<select name="resetTime">
											<option value="1">1</option>
											<option value="2">2</option>
											<option value="3">3</option>
										</select>
										<a href="#nogo" class="button" id="addService">追加</a>
									</p>
									<p>※技能レベル1が最高レベルです。 </p>
								</td>
							</tr>
							<tr>
								<td class="text_left">給料種類:</td>
								<td>
									<select name="salary_type">
										<option value="0">選択してください</option>
										${Utility::Option(array(0 => "時給", 1 => "月給"), $staff['salary_type'])}
									</select>
								</td>
							</tr>
							<tr>
								<td class="text_left">時給：</td>
								<td><input type="text" name="salary" value="{$staff['salary']}" require="true" datatype="require|limit" min="2" />円</td>
							</tr>
						</tbody>
					</table>

					</div>
					<p class="bottom_m"><a class="button" href="document.form.submit()">登録</a></p>
					<p class="bottom_m"><a href="{$_SERVER['HTTP_REFERER']}">戻る</a></p>
					<div style="display:none;">
					<table>
							<tr>
								<td colspan="7"><div class="pagination"> <a href="#" title="First Page">&laquo; First</a><a href="#" title="Previous Page">&laquo; Previous</a> <a href="#" class="number" title="1">1</a> <a href="#" class="number" title="2">2</a> <a href="#" class="number current" title="3">3</a> <a href="#" class="number" title="4">4</a> <a href="#" title="Next Page">Next &raquo;</a><a href="#" title="Last Page">Last &raquo;</a> </div>

									<!-- End .pagination -->
									<div class="clear"></div></td>
							</tr>
							</table>
					</div>
				</div>
			</div>
			</form>
			<!-- End .content-box-content -->
		</div>

		<!-- End .content-box -->
		<!-- End .content-box -->
		<!-- End .content-box -->
		<div class="clear"></div>
		<!-- Start Notifications -->
		<!-- End Notifications -->
		<div id="footer"> <small>
			<!-- Remove this notice or replace it with whatever you want -->

			&#169; Copyright 2011 川崎エステ　エレガントリゾート　すべての女性を美しく幸せに | Powered by <a href="#">ZHONGHUA</a> | <a href="#">Top</a> </small> </div>
		<!-- End #footer -->
	</div>
	<!-- End #main-content -->
</div>

</body>
<!-- Download From www.exet.tk-->
</html>

<script type="text/javascript"><!-- 
jQuery(function(){
	$("a[class='close_btn']").bind('click', function(){
		var data = "action=del&serviceId=" + $(this).attr("serviceId") + "&staffId=" + $(this).attr('staffId');
		var This = this;
		$.get("{$webRoot}/service/staffSkillEdit.php", data, function(data){
			if( data['error'] == 0 ){
				$(This).unbind('click');
				$(This).parent().parent().remove();
			}
			
		}, "json");
	});

	$("#addService").bind('click', function(){
		var staffId = $("input[name='staff_id']").val();
		var serviceId = $("select[name='service_id']").val();
		var resetTime = $("select[name='resetTime']").val();
		if( serviceId < 1 ){
			return ;
		}
		var data = "action=add&serviceId=" + serviceId + "&staffId=" + staffId + "&resetTime=" + resetTime;
		$.get("{$webRoot}/service/staffSkillEdit.php", data, function(data){
			if( data['error'] == 0 ){
				$("#addDelete").append("<tr><td>" + data.data + "</td><td>" + '<a class="close_btn" staffId="' + staffId + '" serviceId="' + serviceId + '"></a></td></tr>');
				$("a[class='close_btn']").last().bind('click', function(){
					var data = "action=del&serviceId=" + $(this).attr("serviceId") + "&staffId=" + $(this).attr('staffId');
					var This = this;
					$.get("{$webRoot}/service/staffSkillEdit.php", data, function(data){
						if( data['error'] == 0 ){
							$(This).unbind('click');
							$(This).parent().parent().remove();
						}
						
					}, "json");
				})
			}
		}, "json");
	});

	$("select[name='shop_id']").bind("change", function(){
		if( $(this).val() < 1 ){
			return ;
		}
		$.get("{$webRoot}/ajax/GetServiceList.php", "shopId=" + $(this).val(), function(data){
			var options = '<option value="0">選択してください</option>';
			for(var index in data.data){
				if( !index ){
					continue;
				}
				options = options + '<option value="' + index + '">' + data.data[index].service_name + '</option>';
			}
			$("select[name='service_id']").html(options);
		}, "json");
		
	});
});
--></script> 
</html> 